
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Granted v0.0</title>
<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />
<!--[if IE]>
<link rel="stylesheet" media="all" type="text/css" href="../css/pro_dropline_ie.css" />
<![endif]-->

<!--  jquery core -->
<script src="js/jquery/jquery-1.4.1.min.js" type="text/javascript"></script>

<!--  checkbox styling script -->
<script src="js/jquery/ui.core.js" type="text/javascript"></script>
<script src="js/jquery/ui.checkbox.js" type="text/javascript"></script>
<script src="js/jquery/jquery.bind.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	$('input').checkBox();
	$('#toggle-all').click(function(){
 	$('#toggle-all').toggleClass('toggle-checked');
	$('#mainform input[type=checkbox]').checkBox('toggle');
	return false;
	});
});
</script>  

<![if !IE 7]>

<!--  styled select box script version 1 -->
<script src="js/jquery/jquery.selectbox-0.5.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
	$('.styledselect').selectbox({ inputClass: "selectbox_styled" });
});
</script>
 

<![endif]>

<!--  styled select box script version 2 --> 
<script src="js/jquery/jquery.selectbox-0.5_style_2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
	$('.styledselect_form_1').selectbox({ inputClass: "styledselect_form_1" });
	$('.styledselect_form_2').selectbox({ inputClass: "styledselect_form_2" });
});
</script>

<!--  styled select box script version 3 --> 
<script src="Users/JAI SHRI RAM/js/jquery/jquery.selectbox-0.5_style_2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
	$('.styledselect_pages').selectbox({ inputClass: "styledselect_pages" });
});
</script>

<!--  styled file upload script --> 
<script src="js/jquery/jquery.filestyle.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
  $(function() {
      $("input.file_1").filestyle({ 
          image: "images/forms/choose-file.gif",
          imageheight : 21,
          imagewidth : 78,
          width : 310
      });
  });
</script>

<!-- Custom jquery scripts -->
<script src="js/jquery/custom_jquery.js" type="text/javascript"></script>
 
<!-- Tooltips -->
<script src="js/jquery/jquery.tooltip.js" type="text/javascript"></script>
<script src="js/jquery/jquery.dimensions.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
	$('a.info-tooltip ').tooltip({
		track: true,
		delay: 0,
		fixPNG: true, 
		showURL: false,
		showBody: " - ",
		top: -35,
		left: 5
	});
});
</script> 
<script>
function validateForm()
{
var x=document.forms["new_user_form"]["userName"].value;
var y=document.forms["new_user_form"]["emailaddress"].value;
var z=document.forms["new_user_form"]["X"].value;


if (x==null || x=="" || y==null || y=="" || z==null || z=="")
  {
  alert("Please complete the form.");
  return false;
  }
}
</script>

<script>
function checkEmail() {
var email = document.getElementById('emailaddress');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value)) {
alert('Please provide a valid email address');
email.focus();
email.value="";
return false;
}
}
</script>

<script>
function validName(){
var userName=document.getElementById('userName');
var reg=/^[A-Z][a-z]+$/;
if(!reg.test(userName.value)){
alert("Invalid Name. Please enter your Name again.");
userName.focus();
userName.value="";
}

}
</script>

<!-- MUST BE THE LAST SCRIPT IN <HEAD></HEAD></HEAD> png fix -->
<script src="js/jquery/jquery.pngFix.pack.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$(document).pngFix( );
});
</script>
</head>
<body> 
<!-- Start: page-top-outer -->
<div id="page-top-outer">    

<!-- Start: page-top -->
<div id="page-top">

	<!-- start logo -->
	<div id="logo">
	<a href="index.html"><img src="images/shared/granted.png" width="300" height="50" alt="" /></a>
	</div>
	<!-- end logo -->
	
	<!--  start top-search -->
	<div id="top-search">
		<img src="images/shared/IIITD_white__50.png" widht="85" height="50" alt="" />
		
 	<div class="clear"></div>

</div>
<!-- End: page-top -->

</div>
<!-- End: page-top-outer -->
</div>
<div class="clear">&nbsp;</div>
 
<!--  start nav-outer-repeat................................................................................................. START -->
<div class="nav-outer-repeat"> 
<!--  start nav-outer -->
<div class="nav-outer"> 

		<!-- start nav-right -->
	<div id="nav-right">
		
			<!--div class="nav-divider">&nbsp;</div>
			<div class="showhide-account"><img src="../images/shared/nav/nav_myaccount.gif" width="93" height="14" alt="" /></div-->
			<div class="nav-divider">&nbsp;</div>
			
			<div class="clear">&nbsp;</div>
		
				
		</div>
		<!-- end nav-right -->


		<!--  start nav -->
		<!--  start nav -->

</div>
<div class="clear"></div>
<!--  start nav-outer -->
</div>
<!--  start nav-outer-repeat................................................... END -->

 <div class="clear"></div>
 
<!-- start content-outer ........................................................................................................................START -->
<div id="content-outer">
<!-- start content -->
<div id="content">

	<!--  start page-heading -->
	<div id="page-heading">
		<h1>New User Registration</h1>
	</div>
	<!-- end page-heading -->

	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner">
		
			<!--  start table-content  -->
			<div id="table-content">
			
			<?php
require 'php/database.php';
try{

if(!isset($_GET['register']))
{
	 
	


echo "

<head>
</head>
<body>
<div align=\"center\">
<h3 style=\"font-size: 18px\">You are not Registered in our System.<br><br>
Kindly fill the following form and we will review your request.</h3><br><br>

<form action=\"?register\" method=\"POST\" name=\"new_user_form\" onsubmit=\"return validateForm()\">  
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"  id=\"id-form\" >
		<tr>
			<th valign=\"top\">Name</th>
			<td><input  type=\"text\" class=\"inp-form-error\" name=\"userName\" id=\"userName\" onchange=\"validName()\"/></td>
			<!--td>
			<div class=\"error-left\"></div>
			<div class=\"error-inner\">This field is required.</div>
			</td-->
		</tr>
		
		<tr>
			<th valign=\"top\">Email ID</th>
			<td><input  type=\"text\" class=\"inp-form\" name=\"emailaddress\" id=\"emailaddress\" onchange=\"checkEmail()\"/></td>
			
		</tr>
		<tr>
		<th valign=\"top\">Role</th>
		<td>	
		<select  class=\"styledselect_form_1\" name=\"X\">
			<option value=\"PHD\">PHD</option>
			<option value=\"ADVISOR\">ADVISOR</option>
			<option value=\"PGC\">PGC</option>
			<option value=\"OFFICE\">OFFICE</option>
			
		</select>
		</td>
		
		<tr>
		
		<td>	
		
		</td>
		
		
		
		</tr> 
	
    	<tr>
				<tr>
			
		<td>	
		</td>
		</tr>
		<tr>
	
		</tr>
		<tr>
	
    
    	
		
		
	</tr>
	
	
	<tr>
		<th>&nbsp;</th>
		<td valign=\"top\">
			<input type=\"submit\" value=\"Submit\" class=\"form-submit\" />
			<input type=\"reset\" value=\"Reset\" class=\"form-reset\"  />
		</td>
		
	</tr>
	</table>
	<!-- end id-form  -->
</div>
</form>


</body>
";

}
else{
	$db = new DatabaseManager();
	$connection = $db->getDB();
	echo "(".$_POST['userName'].",".$_POST['emailaddress'].",".$_POST['X'].")";
	$query = "insert into new_user values('".$_POST['userName']."','".$_POST['emailaddress']."','".$_POST['X']."')";
	$result = mysqli_query($connection,$query);
	if($result){
		echo "Your details have been forwarded to the admin, who will be looking into your request.";
	}
	else {
		echo "Soemthing is wrong!";
	}
}
}catch(Exception $e) {}

?>
			
				
			</div>
			<!--  end content-table  -->
		
			<!--  start actions-box ............................................... -->
			
			<!-- end actions-box........... -->
			
			<!--  start paging..................................................... -->
				<!--  end paging................ -->
			
			<div class="clear"></div>
		 
		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	<div class="clear">&nbsp;</div>

</div>
<!--  end content -->
<div class="clear">&nbsp;</div>
</div>
<!--  end content-outer........................................................END -->

<div class="clear">&nbsp;</div>
    
<!-- start footer -->         
<div id="footer">
	<!--  start footer-left -->
	<div id="footer-left">
	
	Granted&copy;	 <span id="spanYear"></span> <a href="">iiitd.ac.in</a>. All rights reserved.</div>
	<!--  end footer-left -->
	<div class="clear">&nbsp;</div>
</div>
<!-- end footer -->
 
</body>
</html>
